#ifndef __logger__h__included__
#define __logger__h__included__

#include "neiderra/core/Base.h"

#include <string>
#include <stack>

//#include "core/io/IOStream.h"
#include "neiderra/core/io/iStreamable.h"
#include "neiderra/core/iEnvExporter.h"

using namespace neiderra::core;
using namespace std;
// using namespace neiderra::core::io;

namespace neiderra { 
	namespace utils {

		// Log subsystem interface
		class Logger: public Base, public iEnvExporter, public iStreamable
		{
		public:
			Logger(Core* _core);
			Logger(): Base(0){}
			virtual ~Logger();
	
			virtual void log(const char* c_str);
			virtual void log(const std::string& str);
			virtual void log(double number);
			virtual void log(float number);
			virtual void log(int number);
			// begin tracing block
			virtual void traceBlock(const char* blockName);
			// begin tracing block
			virtual void traceBlock(const std::string& str){ traceBlock(str.c_str()); }
			// stop tracing block
			virtual void leaveBlock();
			// log message with prefix "fatal error:"
			virtual void fatal(const char*);
			virtual void warning(const std::string&);
			virtual void resetDepth() { depth = 0; }

			//virtual bool setOutput(iOutputStream*);
			/*virtual CoreLogger& operator<<(const char*);
			virtual const CoreLogger& operator<<(const std::string&);*/
			//...
			
			virtual void executeMethod(const string& name, const list<string>& args );
			virtual void exportMembers();

		private:
			//iOutputStream *_out;
			stack<string> _blocks;
			int depth;
		} ;

//		void assert(bool, const std::string&);

//		CoreLogger& operator<<(CoreLogger% log, T s){return log;}
	}
}

//extern CoreLogger blog;

#endif 
